import React from "react";
import { Routes, Route, Navigate } from "react-router-dom";

import { permits } from "./data";
import Menu from "./Menu"

function Home(){
  const children = permits.filter(p=>p.parentId===1)
  const menuProps = {permits, children}
  return (<Menu {...menuProps}/>)
}

export default function App() {
  return (
    <nav>
      <Routes>
        <Route path="/home/*" element={<Home />}></Route>
        <Route path="/*" element={<Navigate to="/home"/>}></Route>
      </Routes>
    </nav>
  );
}